package com.faner.fast.exception;

import com.faner.fast.constant.enums.CodeEnum;
import org.springframework.http.HttpStatus;

/**
 * 资源不存在异常
 * description: NotFoundException
 * date: 2020/11/20 16:17
 * author: faner
 */
public class NotFoundException extends HttpException {
    private int code = CodeEnum.NOT_FOUND.getCode();

    private int httpCode = HttpStatus.NOT_FOUND.value();

    public NotFoundException() {
        super(CodeEnum.NOT_FOUND.getCode(), CodeEnum.NOT_FOUND.getMessage());
    }

    public NotFoundException(String message) {
        super(message);
    }

    public NotFoundException(int code) {
        super(code, CodeEnum.NOT_FOUND.getMessage());
        this.code = code;
    }

    public NotFoundException(int code, String message) {
        super(code, message);
        this.code = code;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public int getHttpCode() {
        return httpCode;
    }
}
